package com.busionline.wotu.woochenandroid.tools;

import android.widget.Toast;

import com.busionline.wotu.woochenandroid.BuildConfig;
import com.busionline.wotu.woochenandroid.WoochenApplication;

/**
 * 项目名称：ShellFrame
 * 类描述：
 * 创建人：woochen123
 * 创建时间：2016/11/30 0:47
 * 修改人：Administrator
 * 修改时间：2016/11/30 0:47
 * 修改备注：只有debug模式下才会打印
 */

public class ToastUtil {
    private static Toast toast;

    private ToastUtil() {
    }

    /**
     * 普通toast(在debug模式下和release模式下均弹出)
     * @param msg
     */
    public static void showToast(String msg) {
        if (toast == null) {
            toast = Toast.makeText(WoochenApplication.mContext, msg, Toast.LENGTH_SHORT);
        } else {
            toast.setText(msg);
        }
        toast.show();
    }


    /**
     * 仅在debug模式下才会弹出
     * @param msg
     */
    public static void showDebugToast(String msg) {
        if(BuildConfig.DEBUG){
            if (toast == null) {
                toast = Toast.makeText(WoochenApplication.mContext, msg, Toast.LENGTH_SHORT);
            } else {
                toast.setText(msg);
            }
            toast.show();
        }
    }


}
